//
//  BaseOperation.m
//  SFASalesReport
//
//  Created by Jonas on 16/8/4.
//  Copyright © 2016年 Jonas. All rights reserved.
//

#import "BaseOperation.h"
static BaseOperation *baser = nil;
@implementation BaseOperation

//单例
+ (BaseOperation *)shareManager {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        baser = [[BaseOperation alloc] init];
    });
    return baser;
}

//弹窗提示
- (void)alertShow:(UIViewController *)vc Message:(NSString *)msg {
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:msg preferredStyle:UIAlertControllerStyleAlert];
    //取消
    __weak typeof(self) weakSelf = self;
    UIAlertAction *actC = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        if (weakSelf.actionCancle) {
            weakSelf.actionCancle();
        }
    }];
    //确定
    UIAlertAction *actS = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        if (weakSelf.actionSure) {
            weakSelf.actionSure();
        }
    }];
    
    [alert addAction:actC];
    [alert addAction:actS];
    [vc presentViewController:alert animated:YES completion:nil];
    
}
@end
